<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/Css/admin/ui-v1.0.css" rel="stylesheet" type="text/css" media="all">
<script type="text/javascript" src="/js/jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
<script type="text/javascript" src="/js/admin/v3.2.js"></script>
<script type="text/javascript">
$(function(){
	function reload(){
		$.loadContent(document.body,'文章列表',{query:location.search.substring(1)})
	}
	$('#btnSearch').live('click',function(){
		$('#frmSearch').submit();
	})
	
	$('#btnUpdate').live('click',function(){
		//alert($('#frmArticleList').serialize())
		var s = '';
		var chkboxval = $.getCheckbox('id',true);
		if(chkboxval){
			$('#frmArticleList input.inputOrder').each(function(){
					if((','+chkboxval).indexOf(','+this.name+',')>=0)
						s += this.name+'='+this.value+',';
				})
			$.doCmd('UpdateOrder',
				{method:'post',query:'str='+encodeURI(s),
					success:reload})
		}
	})
	$('#btnIssue').live('click',function(){
		$.doCmd('Issue',
			{checkbox:'id',query:'guid={request:guid}',
				success:reload})
	})
	$('#btnAudit1').live('click',function(){
		$.doCmd('Audit1',
			{checkbox:'id',
				success:reload})
	})
	$('#btnAudit2').live('click',function(){
		$.doCmd('Audit2',
			{checkbox:'id',
				success:reload})
	})
	$('#btnBack').live('click',function(){
		$.doCmd('Rework',
			{checkbox:'id',confirm:true,title:'返工操作',
				success:reload})
	})
	$('#btnTreeSearch').live('click',function(){
		top.frames['leftFrame'].$("#treeNav").jstree("search",this.rel);;
	})
	$('#btnDel').live('click',function(){
		$.doCmd('Delete',
			{checkbox:'id',confirm:true,title:'删除文章',
				success:reload})
	})
	$('#allselect').live('click',function(){
		var val = this.checked;
		$("input[name='"+this.value+"']").each(function(){if(!this.disabled)this.checked=val;}); 
	})
	$('#btnMove').live('click',function(){
		var chkboxval = $.getCheckbox('id',true);
		if(chkboxval){
			$('#divMove').dialog({
				buttons :{
					'确认':function(){
						val = $('#channelid').val();
						q = 'id='+chkboxval+'&channelid='+encodeURI(val)+'&iskeeporder='+$('#iskeeporder').val();
						$.doCmd('Move',
							{query:q,success:reload,confirm:true,title:'移至栏目'+$('#amdChannelName').val()})
					},
					'取消':function(){
						$(this).dialog('close');
					}
				}
				});
			$('#amdChannelName').autocomplete({
				delay: 0,
				source: function( request, response ) {
					var query= 'f='+encodeURI('channelSelect')+'&keywords='+encodeURI(request.term);
					$.ajax({
						type:'get',
						dataType: "json",
						beforeSend : function(xhr){	xhr.setRequestHeader("HTTP_X_XMLHTTP_MODE", "true"); },
						url:location.pathname,
						data: query,
						success: response
					})
				},
				select: function( event, ui ) {
					$('#amdChannelName').val(ui.item.label);
					$('#channelid').val(ui.item.value);
					return false;
/*					log( ui.item ?
						"Selected: " + ui.item.label :
						"Nothing selected, input was " + this.value);*/
				}
			});
		}
	})
	$('#btnTopSet').live('click',function(){
		var val = $.getCheckbox('id',true)
		if(val)
			window.open('batchtopset.html?id='+val);
/*		$.doCmd('Issue',
			{checkbox:'id',method:'post',query:$('#frmArticle').serialize(),
				success:reload})*/
	})
	$('#btnKeywordsSet').live('click',function(){
		var chkboxval = $.getCheckbox('id',true);
		if(chkboxval)
			$('#divKeywordsSet').dialog({
				buttons :{
					'确认':function(){
						var val = $('#_iikeyword').val();
						if(val.length<1){
							alert('请填写文章关键词.\n关多个关键词使用半角分号(;)分隔');
							return;
						}
						q = 'id='+chkboxval+'&keywords='+encodeURI(val);
						$.doCmd('KeywordsSet',
							{query:q,
								success:function(){alert('成功批量修改关键词!! ');reload();}})
					},
					'取消':function(){
						$(this).dialog('close');
					}
				}
			});
	})
	$('#btnIssueDateTime').live('click',function(){
		if($.getCheckbox('id',true))
			$('#divIssueDateTime').dialog({buttons:{
				'确认':function(){

					},
				'取消':function(){
					$(this).dialog('close');
				}}
			});
	})
})
</script>
<title>文章列表</title>
</head>

<body class="mainContent">

<city_list>文章列表</city_list>


</body>
</html>
